package kafkaMdw

import (
	"context"
	"fmt"
	"github.com/segmentio/kafka-go"
	"log"
)

func Producer() {
	conn, err := kafka.DialLeader(context.Background(), "tcp", "localhost:9092", "chris-topic", 0)
	if err != nil {
		log.Fatalln(err)
	}
	defer conn.Close()

	message := kafka.Message{Key: []byte("key"), Value: []byte("2222")}
	_, err = conn.WriteMessages(message)
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println("success....")
}
